<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: shanpengfei
  Date: 2019/2/28
  Time: 5:58 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="basePath" value="/zyz"></c:set>
<style>
    .news-ul {
        padding: 30px;
    }
    .news-ul .news-li {
        padding: 10px 0;
    }
</style>

<jsp:include page="../template_header.jsp"></jsp:include>

<c:if test="${sessionScope.user.username=='admin'}">
    <div class="item-text-item"><a href="${basePath}/news/add">添加</a></div>
</c:if>

<ul class="news-ul">
    <c:forEach items="${page.list}" var="list" varStatus="index">
        <li class="news-li">
            <a href="${basePath}/news/show/${list.id}">
                ${index.index+1}.
                ${list.title}
            </a>
            <c:if test="${sessionScope.user.username=='admin'}">
                <a href="${basePath}/news/del/${list.id}">删除</a>
            </c:if>
        </li>

    </c:forEach>
</ul>


<ul class="user-list-page">
    <c:if test="${!page.isFirstPage}">
        <li class="fl"><a href="${basePath}/news/1">首页</a></li>
    </c:if>
    <c:if test="${page.hasPreviousPage}">
        <li class="fl"><a href="${basePath}/news/${page.pageNum-1}">上一页</a></li>
    </c:if>
    <span class="fl">${page.pageNum}</span>
    <c:if test="${page.hasNextPage}">
        <li class="fl"><a href="${basePath}/news/${page.pageNum+1}">下一页</a></li>
    </c:if>
    <c:if test="${!page.isLastPage}">
        <li class="fl"><a href="${basePath}/news/${page.pages}">尾页</a></li>
    </c:if>
    <li class="clear"></li>
</ul>

<jsp:include page="../template_footer.jsp"></jsp:include>
